package com.wva.video.domain.dto;

import com.wva.common.domain.dto.PageQueryDTO;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;

/**
 * @Author: hong
 * @Date: 2025/3/1 18:54:39
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class VideoSearchDTO extends PageQueryDTO {
    /**
     * 搜索内容
     */
    @NotEmpty(message = "搜索内容不能为空")
    private String content;
    /**
     * 发布时间范围，默认截至现在
     */
    @Size(min = 2, max = 2, message = "发布时间格式有误")
    private LocalDateTime[] publishTimeRange = new LocalDateTime[] {null, LocalDateTime.now()};

    /**
     * 时长范围，单位秒，精确到小数点后两位小数，默认全部
     * 对于  1,  ,1    1,1   都可以正常解析，其它不行
     */
    @Size(min = 2, max = 2, message = "时长范围格式有误")
    private Double[] durationRange = new Double[] {0.01, null};

    /**
     * 分类id，默认全部
     */
    private Long categoryId;

    /**
     * 每页数量，默认20
     */
    @Min(value = 1, message = "每页数量最少要为1")
    @Max(value = 100, message = "分页数量太大了")
    private Integer pageSize = 20;
}
